#!/user/bin/env node

console.log("have wrong!");

const Dog = require('./05-dog.js');


let pengpeng = new Dog('pengpeng', 4),
    huihui = new Dog('huihui',6);

pengpeng.on('bark',onBark.bind(pengpeng));
huihui.on('bark',onBark.bind(huihui));


function onBark(){
  console.log(`${this.name}:barked! enery:${this.energy}`);
}

setTimeout(()=>{
  console.log('pengpeng eat food');
  pengpeng.setEnergy(3);
},10000);

